<template>
	<!-- 福利购 -->
	<view class="welfare" v-show="list.length">
		<view class="welfare-title flex flex-ai-c flex-jc-sb">
			<!-- 左边 -->
			<view class="flex flex-ai-c">
				<view class="line"></view>
				<view class="title">{{title}}</view>
			</view>
			<!-- 右边 -->
			<view v-show='!isShow' class="welfare-right flex flex-ai-c"
				@click="goPage('/pages_buy_index/welfareDetails/welfareDetails')">
				<view>全部</view>
				<view>
					<u-icon name="arrow-right" size="23" color="#999999"></u-icon>
				</view>
			</view>
		</view>
		<view style="margin-bottom: 30rpx;" v-show='isShow'>
			<view style="font-size: 24rpx;color: #999999;margin:10rpx 0 30rpx 0">专享超值优惠，为你省更多</view>
		</view>

		<!-- 列表 -->
		<view class="welfare-list" v-for="(item,index) in list.slice(0,2)" :key='item.id'>
			<view class="flex">
				<view class="welfare-img">
					<image :src="item.pic_URL" v-if="item.pic_URL"></image>
				</view>
				<view class="welfare-text flex flex-dir-c flex-jc-sb">
					<view style="font-weight: bold;font-size: 28rpx;">{{item.coupon_Name}}</view>
					<view class="scale flex"
						style="font-size: 24rpx;line-height: 30rpx;position: relative;color: #999999;"
						v-for="(item2,index2) in item.selfServiceCarWashGitCardList" :key='index2'>
						<view style="position: relative;">赠送:{{item2.coupon_Name}}</view>
						<view style="position: absolute;right: -100rpx;">x{{item2.limit_Times}}</view>
					</view>
					<!-- footer -->
					<view class="welfare-footer">
						<view class="flex flex-ai-c flex-jc-sb">
							<view class="flex">
								<view style="color: #999999;font-size: 24rpx;">原价：</view>
								<view> <text
										style="text-decoration: line-through;color: #999999;margin-right: 10rpx;">￥{{item.normal_Price}}</text><text
										style="color: #ED6A17;font-weight: bold;">￥{{item.sale_Price}}</text></view>
							</view>

							<view class="welfare-footer-btn" @click="goDetails(item)">手慢无</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		props: {
			//列表
			list: {
				type: Array,
				default: () => {}
			},
			//标题
			title: {
				type: String,
				default: '福利购'
			},
			//是否显示右边全部
			isShow: {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {

			}
		},
		computed: {

		},
		methods: {
			//跳转详情
			goDetails(item) {
				console.log(item)
				uni.navigateTo({
					url: '/pages_buy_index/welfareDetails/welfareDetails?index=0' + '&id=' + item.id
				})
			},
			goPage(url) {
				uni.navigateTo({
					url: url
				})
			},
		}
	}
</script>

<style lang="scss">
	.description {
		display: -webkit-box;
		overflow: hidden;
		text-overflow: ellipsis;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
	}

	.banner2 {
		width: 702rpx;
		height: 250rpx;

		image {
			border-radius: 10rpx;
			width: 100%;
			height: 100%;
		}

		// background-image: url('https://files.yzsheng.com/client/index/carMaintenance/banner.png');
		// background-size: contain;
		// background-repeat: no-repeat;

		&-text {
			width: 225rpx;
			height: 104rpx;
			border: 3rpx solid #666666;
			text-align: center;
			line-height: 104rpx;
			margin: 0 auto;
			font-size: 32rpx;
			font-weight: bold;
			color: #363636;
		}
	}

	//通用线条
	.line {
		width: 10rpx;
		height: 30rpx;
		background: linear-gradient(0deg, #FBD220, #FFE23E);
		border-radius: 5rpx;

	}

	/* 福利购 */
	.welfare {


		.title {
			margin-left: 20rpx;
			font-size: 32rpx;
			font-weight: bold;
			color: #333333;
		}

		/* 右边 */
		.welfare-right {
			color: #999999;
			font-size: 24rpx;
			font-weight: 500;
		}

		/* /列表 */
		.welfare-list {
			margin-bottom: 40rpx;
			margin-top: 20rpx;

			.welfare-img {
				width: 260rpx;
				height: 173rpx;
				background-color: #FEDD58;
				border-radius: 10rpx;

				image {
					box-shadow: 0px 0rpx 10px 0px rgba(0, 0, 0, 0.1);
					border-radius: 10rpx;
					width: 100%;
					height: 100%;
					// border: 2rpx solid red;
				}
			}

			.welfare-text {
				width: 60%;
				margin-left: 20rpx;
			}

			.welfare-footer {
				/* width: 373rpx; */

				&-btn {
					width: 130rpx;
					font-size: 24rpx;
					height: 54rpx;
					background: linear-gradient(0deg, #FBD220, #FFE23E);
					border-radius: 27rpx;
					text-align: center;
					line-height: 54rpx;
					// margin-left: 20rpx;
				}
			}
		}
	}

	.scale {
		transform: scale(0.8);
		transform-origin: 0 0;
	}
</style>
